package cn.service.impl;

import cn.entity.AppVersion;
import cn.entity.Qualification;
import cn.entity.QualificationCondition;
import cn.mapper.QualificationMapper;
import cn.service.QulificationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
//事务注解
public class QulificationServiceImpl extends BaseServiceImpl<Qualification> implements QulificationService {

    @Autowired
    QualificationMapper qualificationMapper;

    @Override
    public PageInfo<Qualification> selectPage(int pageNum, int pageSize, QualificationCondition condition) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<Qualification>(qualificationMapper.selectPage(condition));
    }

    @Override
    public Qualification selectUpdate(Long id) {
        Qualification qualification = qualificationMapper.selectUpdate(id);
        qualification.setAddress("/uploads/"+qualification.getCid()+"/"+qualification.getAddress());
//        System.out.println(qualification.getAddress());
        return qualification;
    }
}
